home *** CD-ROM | disk | FTP | other *** search
/ Programming in Microsoft Windows with C# / Programacion en Microsoft Windows con C#.iso / Original Code / An Exercise in Text Output / SysInfoColumns / SysInfoColumns.cs next >
Encoding:
Text File  |  2001-01-15  |  3.0 KB  |  82 lines

  1. //---------------------------------------------
  2. // SysInfoColumns.cs ⌐ 2001 by Charles Petzold
  3. //---------------------------------------------
  4. using System;
  5. using System.Drawing;
  6. using System.Windows.Forms;
  7.  
  8. class SysInfoColumns: Form
  9. {
  10.      public static void Main()
  11.      {
  12.           Application.Run(new SysInfoColumns());
  13.      }
  14.      public SysInfoColumns()
  15.      {
  16.           Text = "System Information: Columns";
  17.           BackColor = SystemColors.Window;
  18.           ForeColor = SystemColors.WindowText;
  19.      }
  20.      protected override void OnPaint(PaintEventArgs pea)
  21.      {
  22.           Graphics grfx  = pea.Graphics;
  23.           Brush    brush = new SolidBrush(ForeColor);
  24.           SizeF    sizef;
  25.           float    cxCol, y = 0;
  26.           int      cySpace;
  27.  
  28.           sizef   = grfx.MeasureString("ArrangeStartingPosition ", Font);
  29.           cxCol   = sizef.Width;
  30.           cySpace = Font.Height;
  31.  
  32.           grfx.DrawString("ArrangeDirection", Font, brush, 0, y);
  33.           grfx.DrawString(SystemInformation.ArrangeDirection.ToString(), 
  34.                           Font, brush, cxCol, y);
  35.           y += cySpace;
  36.  
  37.           grfx.DrawString("ArrangeStartingPosition", Font, brush, 0, y);
  38.           grfx.DrawString(SystemInformation.ArrangeStartingPosition.ToString(), 
  39.                           Font, brush, cxCol, y);
  40.           y += cySpace;
  41.  
  42.           grfx.DrawString("BootMode", Font, brush, 0, y);
  43.           grfx.DrawString(SystemInformation.BootMode.ToString(), 
  44.                           Font, brush, cxCol, y);
  45.           y += cySpace;
  46.  
  47.           grfx.DrawString("Border3DSize", Font, brush, 0, y);
  48.           grfx.DrawString(SystemInformation.Border3DSize.ToString(), 
  49.                           Font, brush, cxCol, y);
  50.           y += cySpace;
  51.  
  52.           grfx.DrawString("BorderSize", Font, brush, 0, y);
  53.           grfx.DrawString(SystemInformation.BorderSize.ToString(), 
  54.                           Font, brush, cxCol, y);
  55.           y += cySpace;
  56.  
  57.           grfx.DrawString("CaptionButtonSize", Font, brush, 0, y);
  58.           grfx.DrawString(SystemInformation.CaptionButtonSize.ToString(), 
  59.                           Font, brush, cxCol, y);
  60.           y += cySpace;
  61.  
  62.           grfx.DrawString("CaptionHeight", Font, brush, 0, y);
  63.           grfx.DrawString(SystemInformation.CaptionHeight.ToString(), 
  64.                           Font, brush, cxCol, y);
  65.           y += cySpace;
  66.  
  67.           grfx.DrawString("ComputerName", Font, brush, 0, y);
  68.           grfx.DrawString(SystemInformation.ComputerName, 
  69.                           Font, brush, cxCol, y);
  70.           y += cySpace;
  71.  
  72.           grfx.DrawString("CursorSize", Font, brush, 0, y);
  73.           grfx.DrawString(SystemInformation.CursorSize.ToString(), 
  74.                           Font, brush, cxCol, y);
  75.           y += cySpace;
  76.  
  77.           grfx.DrawString("DbcsEnabled", Font, brush, 0, y);
  78.           grfx.DrawString(SystemInformation.DbcsEnabled.ToString(), 
  79.                           Font, brush, cxCol, y);
  80.     }
  81. }
  82.